package com.sgb.kjwl.view.ui.adapter.self;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.self.ApprovalListEntity;
import com.sgb.kjwl.view.ui.fragment.self.ApprovalManagerFragment;
import com.sgb.kjwl.view.widget.manage.StatusView;

import java.util.List;

public class ApproveManageAdapter extends BaseQuickAdapter<ApprovalListEntity,BaseViewHolder> {

    ApprovalManagerFragment approvalManagerFragment;
    public ApproveManageAdapter(@Nullable List<ApprovalListEntity> data, ApprovalManagerFragment approvalManagerFragment) {
        super(R.layout.item_approve_list, data);
        this.approvalManagerFragment = approvalManagerFragment;
    }

    @Override
    protected void convert(BaseViewHolder helper, ApprovalListEntity item) {
        helper.setText(R.id.tv_title, item.getBusinessName())
                .setText(R.id.tv_user_name, item.getData().getUserName())
                .setText(R.id.tv_times, item.getCreat_time());

                helper.setText(R.id.tv_type_content, item.getApproverTypeName());
        StatusView tvStatus = helper.itemView.findViewById(R.id.tv_status);
        switch (item.getApproverStatus()){
            case -1://待审批
            case 1://审批中
                tvStatus.setText("审批中");
                tvStatus.setBgColor(R.color.color_secondary_blue);
                break;
            case 0://未通过
                tvStatus.setText("已拒绝");
                tvStatus.setBgColor(R.color.color_third_red_easy);
                break;
            case 2://已通过
                tvStatus.setText("已通过");
                tvStatus.setBgColor(R.color.color_secondary_green);
                break;
        }

    }
}
